package lesson19;

import java.security.SecureRandom;
import java.util.Random;
import java.util.concurrent.*;

public class MyCallable {

    static ExecutorService executorService = Executors.newFixedThreadPool(10);

    public static void main(String[] args) {
        Future future = executorService.submit(new CallableTask());
        try {
            System.out.println(future.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }
    }

    static class CallableTask implements Callable<Integer>{
        @Override
        public Integer call() throws Exception {
            return new SecureRandom().nextInt();
        }
    }
}
